package com.zxl.always.on.display.model;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.LayoutInflater;

import com.zxl.always.on.display.R;
import com.zxl.always.on.display.model.bean.ClockInfo;
import com.zxl.always.on.display.ui.widget.clock.BaseClockView;

/**
 * Created by Administrator on 2018/3/2.
 */

public enum ClockStyle {

    CLOCK_DIGITAL(0, R.string.category_digital_clock, R.layout.widget_clock_mode_digital, 4),

    CLOCK_ANALOG(1, R.string.category_analog_clock, R.layout.widget_clock_mode_analog, 7),

    CLOCK_IMAGE(2, R.string.category_image_clock, R.layout.widget_clock_mode_image, 0);

    int id, title, layout, size;

    ClockStyle(int id, int title, int layout, int size) {
        this.id = id;
        this.title = title;
        this.layout = layout;
        this.size = size;
    }

    public int getId() {
        return id;
    }

    public int getLayout() {
        return layout;
    }

    public int getTitle() {
        return title;
    }

    public int getSize() {
        return size;
    }

    public Bitmap getSettingPreview(Context context, ClockInfo clockInfo, int size) {
        BaseClockView baseClockView = (BaseClockView) LayoutInflater.from(context).inflate(layout, null);
        baseClockView.setDigitalStyle(clockInfo.clockPosition);
        baseClockView.setBackgroundStyle(clockInfo.backgroundPosition);
        baseClockView.setPaletteColor(clockInfo.palettePosition);
        baseClockView.refreshTime();
        return baseClockView.getSettingPreview(size);
    }
}
